package com.tangtang.core.log;

import org.apache.log4j.Category;
import org.apache.log4j.Logger;
import org.apache.log4j.Priority;
import org.apache.log4j.jdbc.JDBCAppender;
import org.apache.log4j.spi.LoggingEvent;

public class CustomJDBCAppender extends JDBCAppender {
    @Override
    protected String getLogStatement(LoggingEvent event) {
        String fqnOfCategoryClass = event.fqnOfCategoryClass;
        Category logger = Logger.getRootLogger();
        Priority level = event.getLevel();
        Object message = event.getMessage();
        Throwable throwable = null;
        LoggingEventWithReplaceQuote bEvent = new LoggingEventWithReplaceQuote(fqnOfCategoryClass, logger,
                level, message, throwable);
        return super.getLogStatement(bEvent);
    }
}